package telsoft.app.util;

import javax.swing.*;
import java.awt.event.*;

/**
 *
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2009</p>
 *
 * <p>Company: Telsoft</p>
 *
 * @author HuongNV
 * @version 1.0
 */

public class JXButton extends JButton implements KeyListener
{
    public JXButton()
    {
        super();
        addKeyListener(this);
    }

    public JXButton(String strName)
    {
        super(strName);
        addKeyListener(this);
    }

    public void keyTyped(KeyEvent ke)
    {
        if(ke.getKeyChar() == ke.VK_ENTER || ke.isActionKey())
        {

            doClick();
        }

        //ke.consume();
    }

    public void keyPressed(KeyEvent ke)
    {
        //ke.consume();
    }

    public void keyReleased(KeyEvent ke)
    {
        //ke.consume();
    }
    /*
      public static void main(String[] argv)
      {
     JXButton b = new JXButton();
     JFrame frm = new JFrame();
     frm.getContentPane().add(b);
     frm.show();
      }
     */
}
